﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PsychveyApp1.classes;

namespace PsychveyApp1
{
    public partial class UserAccountHome : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                lblUsernameMyAccount.Text = (string)(Session["username"]);

                //UserAccount currentUser = ((UserAccount)Session["currentUser"]);
                //lblAccountType.Text = currentUser.accountTypeSelected;
                //lblExpirationDateForPremium.Text = currentUser.expirationDateForPremium;
                //lblUsername.Text = currentUser.username;
                //lblUserPassword.Text = currentUser.password;
                //lblUserFullName.Text = currentUser.userFullName;
                //lblEmail.Text = currentUser.email;

                //UserAccount useraccount = (UserAccount)(Session["username"]);
                lblAccountType.Text = DBManager.GetAccountType(lblUsernameMyAccount.Text);
                lblExpirationDateForPremium.Text = DBManager.GetExpirationDateForPremium(lblUsernameMyAccount.Text);
                lblUsername.Text = DBManager.GetUsername(lblUsernameMyAccount.Text);
                lblUserPassword.Text = DBManager.GetPassword(lblUsernameMyAccount.Text);
                lblUserFullName.Text = DBManager.GetFullName(lblUsernameMyAccount.Text);
                lblEmail.Text = DBManager.GetEmailByUsername(lblUsernameMyAccount.Text);

            }
        }

        protected void btnProceed_Click(object sender, EventArgs e)
        {
             if (ddlUser.SelectedIndex == 1)
            {
                Response.Redirect("UserAccountHome.aspx");
             
            }
            else if (ddlUser.SelectedIndex == 2)
            {
                Response.Redirect("Home.aspx");
            }
        }

        protected void ddlUser_SelectedIndexChanged(object sender, EventArgs e)
        {

        }


        protected void btnEditDetails_Click1(object sender, EventArgs e)
        {
            Response.Redirect("UserEditAccount.aspx");    
        }

        protected void AdminLoginShortcut_Click(object sender, EventArgs e)
        {
            Response.Redirect("AdminLogin.aspx");
        }

        protected void LinkButton2_Click(object sender, EventArgs e)
        {
            Response.Redirect("MySurvey.aspx");
        }
    }
}